package com.bookmanagement.controller.user;


import com.bookmanagement.result.PageResult;
import com.bookmanagement.result.Result;
import com.bookmanagement.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 17355
 */
@RestController
@RequestMapping("/record")
public class RecordController {

    @Autowired
    private RecordService recordService;

    @GetMapping
    public Result<PageResult> getAllRecord(){
        PageResult pageResult = recordService.getRecord();
        return Result.success(pageResult);
    }

    @DeleteMapping("/{id}")
    public Result deleteRecord(@PathVariable("id") Integer id){
        recordService.deleteRecord(id);
        return Result.success();
    }

    @GetMapping("/current")
    public Result<PageResult> getCurrentRecord(){
        PageResult pageResult = recordService.getCurrentRecord();
        return Result.success(pageResult);
    }



}
